# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=inifiled
pkgver=1.3.1
pkgrel=1
pkgdesc="a compile time ini file parser and writter generator for D"
url="https://github.com/burner/inifiled"
arch="x86_64 aarch64" # ldc
license="LGPL-3.0-only"
makedepends="ldc ldc-runtime"
subpackages="$pkgname-dev"
source="https://github.com/burner/inifiled/archive/v$pkgver/inifiled-$pkgver.tar.gz"

build() {
	ldc2 source/*.d -shared -Os -soname=libinifiled.so.${pkgver%%.*} -of libinifiled.so
}

check() {
	ldc2 source/*.d -unittest -main -Os -of libinifiled-test
	./libinifiled-test
}

package() {
	install -Dm755 libinifiled.so "$pkgdir"/usr/lib/libinifiled.so.$pkgver
	ln -s libinifiled.so.$pkgver "$pkgdir"/usr/lib/libinifiled.so.${pkgver%%.*}
	ln -s libinifiled.so.${pkgver%%.*} "$pkgdir"/usr/lib/libinifiled.so

	mkdir -p "$pkgdir"/usr/include/d/inifiled
	cp -r source "$pkgdir"/usr/include/d/inifiled/inifiled
}

sha512sums="243433a0ecc155d8012dfd6f2422aac80e1b9b0f9c5b877b5573a02d93180bd7a7407820cdebdec226c498d6b4c14aad544971572e6e3a62846c9e24d4e2c85e  inifiled-1.3.1.tar.gz"
